import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by thoughtworker on 1/16/14.
 */


public class Catalog {
    List<Player> playerList = new ArrayList<Player>();
    List<Coach> coachList = new ArrayList<Coach>();

    public void setPlayerList(List<Player> playerList){
        this.playerList = playerList;
    }

    public void setCoachList(List<Coach> coachList){
        this.coachList = coachList;
    }

    public void printPlayersAndCoaches(PrintStream printStream) {
        for(Player player: playerList)
            player.print(printStream);
        for(Coach coach: coachList)
            coach.print(printStream);
    }

    public Player search(String requestedName, int requestedNumber) {
        for(Player player : playerList){
            if (player.name.equals(requestedName) && (player.number == requestedNumber) ){
                return player;
            }
        }
        return null;
    }
}
